package com.freemalll.merchant.enums;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @author songshixiong
 * @ClassName BizFieldEnum
 * @description:
 * @date 2025年06月20日
 * @version: 1.0
 */
public enum BizFieldEnum {

    applyCnt("applyCnt", "申请笔数"),
    passRatio("passRatio", "批核率"),
    loanCnt("loanCnt", "放款笔数"),
    loanAmt("loanAmt", "放款金额"),
    overCnt("overCnt", "逾期笔数"),
    overBalanceAmt("overBalanceAmt", "逾期金额"),
    fpdOverCnt("fpdOverCnt", "首逾笔数"),
    overAmtRatio("overAmtRatio", "逾期率"),
    fpdOverAmtRatio("fpdOverAmtRatio", "首逾率"),
    newOverAmtRatio("newOverAmtRatio", "新增逾期率");

    private final String field;
    private final String label;

    BizFieldEnum(String field, String label) {
        this.field = field;
        this.label = label;
    }

    public static String getLabelByField(String field) {
        return Arrays.stream(values())
                .filter(e -> e.field.equals(field))
                .map(e -> e.label)
                .findFirst()
                .orElse(field);
    }

    public static List<String> getAllFields() {
        return Arrays.stream(values()).map(e -> e.field).collect(Collectors.toList());
    }
}

